import { useSimulationStore } from '@/stores/modules/simulation'
import { computed } from 'vue'
const simulationStore = useSimulationStore()
const distance_variation_data = computed(() => simulationStore.distance_variation_data)
const time_variation_data = computed(() => simulationStore.time_variation_data)
const fashi_data = computed(() => simulationStore.fashi_data)
// 按时间分组数据
const groupDataByTime = () => {
  const timeGroups = {}
  distance_variation_data.value.forEach((item) => {
    if (!timeGroups[item.time]) {
      timeGroups[item.time] = []
    }
    timeGroups[item.time].push(item)
  })

  return timeGroups
}

// 处理每个时间点的数据
const processTimeData = (timeData) => {
  // 按里程排序
  // console.log(timeData)
  return {
    distance: timeData.map((item) => item.distance),
    temperature: timeData.map((item) => item.temperature),
    pressure: timeData.map((item) => item.pressure),
    flow: timeData.map((item) => item.flow)
  }
}

// 通用的坐标轴文本样式配置
const axisLabelStyle = {
  // color: '#fff' // 坐标轴文本颜色
}

const axisNameStyle = {
  // color: '#fff', // 坐标轴名称颜色
  fontWeight: 'bold' // 加粗文字
}

export const getTemperatureChartOption = (currentTime = 0) => {
  const timeGroups = groupDataByTime()
  const processedData = processTimeData(timeGroups[currentTime] || [])
  // console.log("🐯 ~ getTemperatureChartOption ~ currentTime:", currentTime)
  // console.log("🐯 ~ getTemperatureChartOption ~ processedData:", processedData)

  return {
    animation: false,
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross'
      },
      formatter: function (params) {
        return `里程：${params[0].axisValue} km<br/>温度：${params[0].value} ℃`
      }
    },
    xAxis: {
      type: 'category',
      name: '里程（km）',
      nameLocation: 'middle',
      nameGap: 30,
      data: processedData.distance,
      axisLabel: {
        interval: 10,
        formatter: function (value) {
          return Math.floor(value)
        },
        ...axisLabelStyle
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '温度（℃）',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#FF4500'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '温度',
        type: 'line',
        data: processedData.temperature,
        smooth: true,
        lineStyle: {
          color: 'rgba(231, 130, 213, 1)'
        },
        itemStyle: {
          color: 'rgba(231, 130, 213, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(231, 130, 213, 1)' // 线条颜色
              },
              {
                offset: 1,
                color: 'rgba(231, 130, 213, 0.1)' // 透明度设置为0.1的背景色
              }
            ]
          }
        }
      }
    ]
  }
}

export const getPressureChartOption = (currentTime = 0) => {
  const timeGroups = groupDataByTime()
  const processedData = processTimeData(timeGroups[currentTime] || [])

  return {
    animation: false,
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross'
      },
      formatter: function (params) {
        return `里程：${params[0].axisValue} km<br/>压力：${params[0].value} MPa`
      }
    },
    xAxis: {
      type: 'category',
      name: '里程（km）',
      nameLocation: 'middle',
      nameGap: 30,
      data: processedData.distance,
      axisLabel: {
        interval: 10,
        formatter: function (value) {
          return Math.floor(value)
        },
        ...axisLabelStyle
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '压力（MPa）',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#4169E1'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '压力',
        type: 'line',
        data: processedData.pressure,
        smooth: true,
        lineStyle: {
          color: 'rgba(10, 190, 237, 1)'
        },
        itemStyle: {
          color: 'rgba(10, 190, 237, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(10, 190, 237, 0.5)' // 线条颜色（稍微降低不透明度）
              },
              {
                offset: 1,
                color: 'rgba(10, 190, 237, 0.05)' // 几乎透明的背景色
              }
            ]
          }
        }
      }
    ]
  }
}

export const getFlowChartOption = (currentTime = 0) => {
  const timeGroups = groupDataByTime()
  const processedData = processTimeData(timeGroups[currentTime] || [])

  return {
    animation: false,
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross'
      },
      formatter: function (params) {
        return `里程：${params[0].axisValue} km<br/>流量：${params[0].value} m³/h`
      }
    },
    xAxis: {
      type: 'category',
      name: '里程（km）',
      nameLocation: 'middle',
      nameGap: 30,
      data: processedData.distance,
      axisLabel: {
        interval: 10,
        formatter: function (value) {
          return Math.floor(value)
        },
        ...axisLabelStyle
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '流量（m³/h）',
      min: 0,
      // max:200,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#4169E1'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '流量',
        type: 'line',
        data: processedData.flow,
        smooth: true,
        lineStyle: {
          color: 'rgba(65, 115, 255, 1)'
        },
        itemStyle: {
          color: 'rgba(65, 115, 255, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(65, 115, 255, 0.5)' // 线条颜色（稍微降低不透明度）
              },
              {
                offset: 1,
                color: 'rgba(65, 115, 255, 0.05)' // 几乎透明的背景色
              }
            ]
          }
        }
      }
    ]
  }
}

export const getCombinedPressureFlowChartOption = (currentTime = 0) => {
  const timeGroups = groupDataByTime()
  const processedData = processTimeData(timeGroups[currentTime] || [])

  return {
    animation: false,
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross'
      },
      formatter: function (params) {
        let tooltip = `里程：${params[0].axisValue} km<br/>`
        params.forEach((param) => {
          if (param.seriesName === '压力') {
            tooltip += `压力：${param.value} MPa<br/>`
          } else if (param.seriesName === '流量') {
            tooltip += `流量：${param.value} m³/h`
          }
        })
        return tooltip
      }
    },
    legend: {
      data: ['压力', '流量'],
      right: '5%',
      textStyle: {
        fontSize: 12,
        color: '#333'
      }
    },
    // grid: {
    //   left: '5%',
    //   right: '5%',
    //   bottom: '15%',
    //   containLabel: true
    // },
    xAxis: {
      type: 'category',
      name: '里程（km）',
      nameLocation: 'middle',
      nameGap: 30,
      data: processedData.distance,
      axisLabel: {
        interval: 10,
        formatter: function (value) {
          return Math.floor(value)
        },
        ...axisLabelStyle
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: [
      {
        type: 'value',
        name: '压力（MPa）',
        min: 0,
        position: 'left',
        axisLine: {
          show: true,
          lineStyle: {
            color: 'rgba(10, 190, 237, 1)'
          }
        },
        axisLabel: {
          ...axisLabelStyle,
          color: 'rgba(10, 190, 237, 1)'
        },
        nameTextStyle: {
          ...axisNameStyle,
          color: 'rgba(10, 190, 237, 1)'
        },
        splitLine: {
          show: false
        }
      },
      {
        type: 'value',
        name: '流量（m³/h）',
        min: 0,
        position: 'right',
        axisLine: {
          show: true,
          lineStyle: {
            color: 'rgba(65, 115, 255, 1)'
          }
        },
        axisLabel: {
          ...axisLabelStyle,
          color: 'rgba(65, 115, 255, 1)'
        },
        nameTextStyle: {
          ...axisNameStyle,
          color: 'rgba(65, 115, 255, 1)'
        },
        splitLine: {
          show: false
        }
      }
    ],
    series: [
      {
        name: '压力',
        type: 'line',
        yAxisIndex: 0,
        data: processedData.pressure,
        smooth: true,
        lineStyle: {
          width: 3,
          color: 'rgba(10, 190, 237, 1)'
        },
        itemStyle: {
          color: 'rgba(10, 190, 237, 1)'
        },
        symbol: 'circle',
        symbolSize: 6,
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(10, 190, 237, 0.5)' // 线条颜色（稍微降低不透明度）
              },
              {
                offset: 1,
                color: 'rgba(10, 190, 237, 0.05)' // 几乎透明的背景色
              }
            ]
          }
        }
      },
      {
        name: '流量',
        type: 'line',
        yAxisIndex: 1,
        data: processedData.flow,
        smooth: true,
        lineStyle: {
          width: 3,
          color: 'rgba(65, 115, 255, 1)'
        },
        itemStyle: {
          color: 'rgba(65, 115, 255, 1)'
        },
        symbol: 'circle',
        symbolSize: 6,
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(65, 115, 255, 0.5)' // 线条颜色（稍微降低不透明度）
              },
              {
                offset: 1,
                color: 'rgba(65, 115, 255, 0.05)' // 几乎透明的背景色
              }
            ]
          }
        }
      }
    ]
  }
}

const pressureData = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return time_variation_data.value.map((item) => item.p_weh)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return time_variation_data.value.map((item) => item.p_out_weh)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return time_variation_data.value.map((item) => item.p_out_bkz)
    } else if (simulationStore.predictPipeline === '调油一线（701站-总站））') {
      return time_variation_data.value.map((item) => item.p_out_701)
    } else {
      return time_variation_data.value.map((item) => item.p_out_81)
    }
  }
})
const pressureData2 = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return time_variation_data.value.map((item) => item.p_bkz)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return time_variation_data.value.map((item) => item.p_in_bkz)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return time_variation_data.value.map((item) => item.p_in_701)
    } else if (simulationStore.predictPipeline === '调油一线（701站-总站））') {
      return time_variation_data.value.map((item) => item.p_in_zz)
    } else {
      return time_variation_data.value.map((item) => item.p_in_81)
    }
  }
})
const temperatureData = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return time_variation_data.value.map((item) => item.t_weh)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return time_variation_data.value.map((item) => item.t_out_weh)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return time_variation_data.value.map((item) => item.t_out_bkz)
    } else if (simulationStore.predictPipeline === '调油一线（701站-总站））') {
      return time_variation_data.value.map((item) => item.t_out_701)
    } else {
      return time_variation_data.value.map((item) => item.t_out_81)
    }
  }
})
const temperatureData2 = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return time_variation_data.value.map((item) => item.t_bkz)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return time_variation_data.value.map((item) => item.t_in_bkz)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return time_variation_data.value.map((item) => item.t_in_701)
    } else if (simulationStore.predictPipeline === '调油一线（701站-总站））') {
      return time_variation_data.value.map((item) => item.t_in_zz)
    } else {
      return time_variation_data.value.map((item) => item.t_in_81)
    }
  }
})
const flowData = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return time_variation_data.value.map((item) => item.q_weh)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return time_variation_data.value.map((item) => item.q_wbx)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return time_variation_data.value.map((item) => item.q_bkx)
    } else if (simulationStore.predictPipeline === '调油一线（701站-总站））') {
      return time_variation_data.value.map((item) => item.q_701_zz)
    } else {
      return time_variation_data.value.map((item) => item.q_81_701)
    }
  }
})

const timePoints = computed(() => time_variation_data.value.map((item) => item.time))
console.log('🐯 ~ timePoints.value:', timePoints.value)
// 阀池1、2、3
const valve_pool_1_pressure = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return fashi_data.value.map((item) => item.valve_pool_1_pressure)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return fashi_data.value.map((item) => item.valve_pool_1_pressure_wbx)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return fashi_data.value.map((item) => item.valve_pool_1_pressure_bkx)
    } else {
      return []
    }
  }
})
const valve_pool_1_flow = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return fashi_data.value.map((item) => item.valve_pool_1_flow)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return fashi_data.value.map((item) => item.valve_pool_1_flow_wbx)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return fashi_data.value.map((item) => item.valve_pool_1_flow_bkx)
    } else {
      return []
    }
  }
})
const valve_pool_1_temperature = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return fashi_data.value.map((item) => item.valve_pool_1_temperature)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return fashi_data.value.map((item) => item.valve_pool_1_temperature_wbx)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return fashi_data.value.map((item) => item.valve_pool_1_temperature_bkx)
    } else {
      return []
    }
  }
})
const valve_pool_2_pressure = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return fashi_data.value.map((item) => item.valve_pool_2_pressure)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return fashi_data.value.map((item) => item.valve_pool_2_pressure_wbx)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return fashi_data.value.map((item) => item.valve_pool_2_pressure_bkx)
    } else {
      return []
    }
  }
})
const valve_pool_2_flow = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return fashi_data.value.map((item) => item.valve_pool_2_flow)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return fashi_data.value.map((item) => item.valve_pool_2_flow_wbx)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return fashi_data.value.map((item) => item.valve_pool_2_flow_bkx)
    } else {
      return []
    }
  }
})
const valve_pool_2_temperature = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return fashi_data.value.map((item) => item.valve_pool_2_temperature)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return fashi_data.value.map((item) => item.valve_pool_2_temperature_wbx)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return fashi_data.value.map((item) => item.valve_pool_2_temperature_bkx)
    } else {
      return []
    }
  }
})
const valve_pool_3_pressure = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return fashi_data.value.map((item) => item.valve_pool_3_pressure)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return fashi_data.value.map((item) => item.valve_pool_3_pressure_wbx)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return fashi_data.value.map((item) => item.valve_pool_3_pressure_bkx)
    } else {
      return []
    }
  }
})
const valve_pool_3_flow = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return fashi_data.value.map((item) => item.valve_pool_3_flow)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return fashi_data.value.map((item) => item.valve_pool_3_flow_wbx)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return fashi_data.value.map((item) => item.valve_pool_3_flow_bkx)
    } else {
      return []
    }
  }
})
const valve_pool_3_temperature = computed(() => {
  if (simulationStore.curPipeLine !== '全线') {
    return fashi_data.value.map((item) => item.valve_pool_3_temperature)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return fashi_data.value.map((item) => item.valve_pool_3_temperature_wbx)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return fashi_data.value.map((item) => item.valve_pool_3_temperature_bkx)
    } else {
      return []
    }
  }
})

const valve_pool_4_pressure = computed(() => {
    if (simulationStore.curPipeLine !== '全线') {
     return fashi_data.value.map((item) => item.valve_pool_4_pressure)
  } else {
    if (simulationStore.predictPipeline === '乌百线（乌尔禾站-百克站）') {
      return fashi_data.value.map((item) => item.valve_pool_4_pressure_wbx)
    } else if (simulationStore.predictPipeline === '百克线（百克站-701站）') {
      return fashi_data.value.map((item) => item.valve_pool_4_pressure_bkx)
    } else {
      return []
    }
  }
 
})

const valve_pool_4_flow = computed(() => {
  return fashi_data.value.map((item) => item.valve_pool_4_flow)
})
const valve_pool_4_temperature = computed(() => {
  return fashi_data.value.map((item) => item.valve_pool_4_temperature)
})

const valve_pool_5_pressure = computed(() => {
  return fashi_data.value.map((item) => item.valve_pool_5_pressure)
})

const valve_pool_5_flow = computed(() => {
  return fashi_data.value.map((item) => item.valve_pool_5_flow)
})
const valve_pool_5_temperature = computed(() => {
  return fashi_data.value.map((item) => item.valve_pool_5_temperature)
})

const valve_pool_6_pressure = computed(() => {
  return fashi_data.value.map((item) => item.valve_pool_6_pressure)
})

const valve_pool_6_flow = computed(() => {
  return fashi_data.value.map((item) => item.valve_pool_6_flow)
})
const valve_pool_6_temperature = computed(() => {
  return fashi_data.value.map((item) => item.valve_pool_6_temperature)
})



// 更新 getChartOption 函数
export const getChartOption4 = () => {
  return {
    // title: {
    //   text: '站点运行参数时间变化趋势'
    // },
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间：${params[0].axisValue}<br/>`
        params.forEach((param) => {
          let unit = ''
          if (param.seriesName.includes('压力')) unit = 'MPa'
          else if (param.seriesName.includes('温度')) unit = '°C'
          else if (param.seriesName.includes('流量')) unit = 'm³/h'
          result += `${param.seriesName}：${param.value} ${unit}<br/>`
        })
        return result
      }
    },
    legend: {
      data: ['乌尔禾出站压力', '百克站进站压力', '乌尔禾出站温度', '百克站进站温度', '流量'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 30,
      axisLabel: {
        interval: 9, // 强制显示所有标签
        formatter: function (value) {
          return Math.floor(value) // 确保显示整数
        },
        ...axisLabelStyle
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: [
      {
        type: 'value',
        name: '压力(MPa)',
        position: 'left',
        min: 0,
        axisLine: {
          show: true,
          lineStyle: {
            color: '#000'
          }
        },
        axisLabel: axisLabelStyle,
        nameTextStyle: axisNameStyle
      },
      {
        type: 'value',
        name: '温度(°C)',
        position: 'right',
        min: 0,
        axisLine: {
          show: true,
          lineStyle: {
            color: '#000'
          }
        },
        axisLabel: axisLabelStyle,
        nameTextStyle: axisNameStyle
      },
      {
        type: 'value',
        name: '流量(m³/h)',
        position: 'right',
        min: 0,
        axisLine: {
          show: true,
          lineStyle: {
            color: '#000'
          }
        },
        offset: 80,
        axisLabel: axisLabelStyle,
        nameTextStyle: axisNameStyle
      }
    ],
    series: [
      {
        name: '乌尔禾出站压力',
        type: 'line',
        yAxisIndex: 0,
        data: pressureData.value,
        // itemStyle: { color: '#FF4500' },
        showSymbol: false // 不显示数据点
      },
      {
        name: '百克站进站压力',
        type: 'line',
        yAxisIndex: 0,
        data: pressureData2.value,
        itemStyle: { color: '#FF7F50' },
        showSymbol: false // 不显示数据点
      },
      {
        name: '乌尔禾出站温度',
        type: 'line',
        yAxisIndex: 1,
        data: temperatureData.value,
        itemStyle: { color: '#4169E1' },
        showSymbol: false // 不显示数据点
      },
      {
        name: '百克站进站温度',
        type: 'line',
        yAxisIndex: 1,
        data: temperatureData2.value,
        itemStyle: { color: '#6495ED' },
        showSymbol: false // 不显示数据点
      },
      {
        name: '流量',
        type: 'line',
        yAxisIndex: 2,
        data: flowData.value,
        itemStyle: { color: '#32CD32' },
        showSymbol: false // 不显示数据点
      }
    ]
  }
}

// 压力时间变化图表配置
export const getPressureTimeChartOption = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间 ${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} MPa<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站压力', '进站压力'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '压力(MPa)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站压力',
        type: 'line',
        data: pressureData.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 69, 0, 1)' // #FF4500
        },
        itemStyle: {
          color: 'rgba(255, 69, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 69, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 69, 0, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站压力',
        type: 'line',
        data: pressureData2.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 255, 0, 1)' // #0F0
        },
        itemStyle: {
          color: 'rgba(255, 255, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 255, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 255, 0, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}

// 温度时间变化图表配置
export const getTemperatureTimeChartOption = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间：${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} °C<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站温度', '进站温度'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '温度(°C)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站温度',
        type: 'line',
        data: temperatureData.value,
        smooth: true,
        lineStyle: {
          color: '#38bdf8' // #4169E1
        },
        itemStyle: {
          color: '#38bdf8'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#38bdf8'
              },
              {
                offset: 1,
                color: 'rgba(65, 105, 225, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站温度',
        type: 'line',
        data: temperatureData2.value,
        smooth: true,
        lineStyle: {
          color: '#e879f9' // #632
        },
        itemStyle: {
          color: '#e879f9'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#e879f9'
              },
              {
                offset: 1,
                color: 'rgba(102, 51, 34, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}

// 流量时间变化图表配置
export const getFlowTimeChartOption = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        return `时间：${params[0].axisValue} 分钟<br/>${params[0].seriesName}：${params[0].value} m³/h`
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '流量(m³/h)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '流量',
        type: 'line',
        data: flowData.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(50, 205, 50, 1)' // #32CD32
        },
        itemStyle: {
          color: 'rgba(50, 205, 50, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(50, 205, 50, 1)'
              },
              {
                offset: 1,
                color: 'rgba(50, 205, 50, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}

// 阀池对应的时间变化图表配置
export const getPressureTimeChartOptionFachi1 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间 ${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} MPa<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站压力', '进站压力'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '压力(MPa)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站压力',
        type: 'line',
        data: valve_pool_1_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 69, 0, 1)' // #FF4500
        },
        itemStyle: {
          color: 'rgba(255, 69, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 69, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 69, 0, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站压力',
        type: 'line',
        data: valve_pool_1_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 255, 0, 1)' // #0F0
        },
        itemStyle: {
          color: 'rgba(255, 255, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 255, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 255, 0, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}
export const getPressureTimeChartOptionFachi2 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间 ${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} MPa<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站压力', '进站压力'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '压力(MPa)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站压力',
        type: 'line',
        data: valve_pool_2_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 69, 0, 1)' // #FF4500
        },
        itemStyle: {
          color: 'rgba(255, 69, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 69, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 69, 0, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站压力',
        type: 'line',
        data: valve_pool_2_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 255, 0, 1)' // #0F0
        },
        itemStyle: {
          color: 'rgba(255, 255, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 255, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 255, 0, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}
export const getPressureTimeChartOptionFachi3 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间 ${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} MPa<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站压力', '进站压力'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '压力(MPa)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站压力',
        type: 'line',
        data: valve_pool_3_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 69, 0, 1)' // #FF4500
        },
        itemStyle: {
          color: 'rgba(255, 69, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 69, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 69, 0, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站压力',
        type: 'line',
        data: valve_pool_3_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 255, 0, 1)' // #0F0
        },
        itemStyle: {
          color: 'rgba(255, 255, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 255, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 255, 0, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}

export const getPressureTimeChartOptionFachi4 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间 ${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} MPa<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站压力', '进站压力'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '压力(MPa)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站压力',
        type: 'line',
        data: valve_pool_4_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 69, 0, 1)' // #FF4500
        },
        itemStyle: {
          color: 'rgba(255, 69, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 69, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 69, 0, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站压力',
        type: 'line',
        data: valve_pool_4_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 255, 0, 1)' // #0F0
        },
        itemStyle: {
          color: 'rgba(255, 255, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 255, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 255, 0, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}

export const getPressureTimeChartOptionFachi5 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间 ${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} MPa<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站压力', '进站压力'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '压力(MPa)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站压力',
        type: 'line',
        data: valve_pool_5_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 69, 0, 1)' // #FF4500
        },
        itemStyle: {
          color: 'rgba(255, 69, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 69, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 69, 0, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站压力',
        type: 'line',
        data: valve_pool_5_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 255, 0, 1)' // #0F0
        },
        itemStyle: {
          color: 'rgba(255, 255, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 255, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 255, 0, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}

export const getPressureTimeChartOptionFachi6 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间 ${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} MPa<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站压力', '进站压力'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '压力(MPa)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站压力',
        type: 'line',
        data: valve_pool_6_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 69, 0, 1)' // #FF4500
        },
        itemStyle: {
          color: 'rgba(255, 69, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 69, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 69, 0, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站压力',
        type: 'line',
        data: valve_pool_6_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 255, 0, 1)' // #0F0
        },
        itemStyle: {
          color: 'rgba(255, 255, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 255, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 255, 0, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}





export const getTemperatureTimeChartOptionFachi1 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间：${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} °C<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站温度', '进站温度'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '温度(°C)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站温度',
        type: 'line',
        data: valve_pool_1_temperature.value,
        smooth: true,
        lineStyle: {
          color: '#38bdf8' // #4169E1
        },
        itemStyle: {
          color: '#38bdf8'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#38bdf8'
              },
              {
                offset: 1,
                color: 'rgba(65, 105, 225, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站温度',
        type: 'line',
        data: valve_pool_1_temperature.value,
        smooth: true,
        lineStyle: {
          color: '#e879f9' // #632
        },
        itemStyle: {
          color: '#e879f9'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#e879f9'
              },
              {
                offset: 1,
                color: 'rgba(102, 51, 34, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}
export const getTemperatureTimeChartOptionFachi2 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间：${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} °C<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站温度', '进站温度'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '温度(°C)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站温度',
        type: 'line',
        data: valve_pool_2_temperature.value,
        smooth: true,
        lineStyle: {
          color: '#38bdf8' // #4169E1
        },
        itemStyle: {
          color: '#38bdf8'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#38bdf8'
              },
              {
                offset: 1,
                color: 'rgba(65, 105, 225, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站温度',
        type: 'line',
        data: valve_pool_2_temperature.value,
        smooth: true,
        lineStyle: {
          color: '#e879f9' // #632
        },
        itemStyle: {
          color: '#e879f9'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#e879f9'
              },
              {
                offset: 1,
                color: 'rgba(102, 51, 34, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}
export const getTemperatureTimeChartOptionFachi3 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间：${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} °C<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站温度', '进站温度'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '温度(°C)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站温度',
        type: 'line',
        data: valve_pool_3_temperature.value,
        smooth: true,
        lineStyle: {
          color: '#38bdf8' // #4169E1
        },
        itemStyle: {
          color: '#38bdf8'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#38bdf8'
              },
              {
                offset: 1,
                color: 'rgba(65, 105, 225, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站温度',
        type: 'line',
        data: valve_pool_3_temperature.value,
        smooth: true,
        lineStyle: {
          color: '#e879f9' // #632
        },
        itemStyle: {
          color: '#e879f9'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#e879f9'
              },
              {
                offset: 1,
                color: 'rgba(102, 51, 34, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}

export const getTemperatureTimeChartOptionFachi4 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间：${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} °C<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站温度', '进站温度'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '温度(°C)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站温度',
        type: 'line',
        data: valve_pool_4_temperature.value,
        smooth: true,
        lineStyle: {
          color: '#38bdf8' // #4169E1
        },
        itemStyle: {
          color: '#38bdf8'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#38bdf8'
              },
              {
                offset: 1,
                color: 'rgba(65, 105, 225, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站温度',
        type: 'line',
        data: valve_pool_4_temperature.value,
        smooth: true,
        lineStyle: {
          color: '#e879f9' // #632
        },
        itemStyle: {
          color: '#e879f9'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#e879f9'
              },
              {
                offset: 1,
                color: 'rgba(102, 51, 34, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}
export const getTemperatureTimeChartOptionFachi5 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间：${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} °C<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站温度', '进站温度'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '温度(°C)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站温度',
        type: 'line',
        data: valve_pool_5_temperature.value,
        smooth: true,
        lineStyle: {
          color: '#38bdf8' // #4169E1
        },
        itemStyle: {
          color: '#38bdf8'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#38bdf8'
              },
              {
                offset: 1,
                color: 'rgba(65, 105, 225, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站温度',
        type: 'line',
        data: valve_pool_5_temperature.value,
        smooth: true,
        lineStyle: {
          color: '#e879f9' // #632
        },
        itemStyle: {
          color: '#e879f9'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#e879f9'
              },
              {
                offset: 1,
                color: 'rgba(102, 51, 34, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}
export const getTemperatureTimeChartOptionFachi6 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间：${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} °C<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站温度', '进站温度'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '温度(°C)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '出站温度',
        type: 'line',
        data: valve_pool_6_temperature.value,
        smooth: true,
        lineStyle: {
          color: '#38bdf8' // #4169E1
        },
        itemStyle: {
          color: '#38bdf8'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#38bdf8'
              },
              {
                offset: 1,
                color: 'rgba(65, 105, 225, 0.1)'
              }
            ]
          }
        }
      },
      {
        name: '进站温度',
        type: 'line',
        data: valve_pool_6_temperature.value,
        smooth: true,
        lineStyle: {
          color: '#e879f9' // #632
        },
        itemStyle: {
          color: '#e879f9'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#e879f9'
              },
              {
                offset: 1,
                color: 'rgba(102, 51, 34, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}









export const getFlowTimeChartOptionFachi1 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        return `时间：${params[0].axisValue} 分钟<br/>${params[0].seriesName}：${params[0].value} m³/h`
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '流量(m³/h)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '流量',
        type: 'line',
        data: valve_pool_1_flow.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(50, 205, 50, 1)' // #32CD32
        },
        itemStyle: {
          color: 'rgba(50, 205, 50, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(50, 205, 50, 1)'
              },
              {
                offset: 1,
                color: 'rgba(50, 205, 50, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}
export const getFlowTimeChartOptionFachi2 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        return `时间：${params[0].axisValue} 分钟<br/>${params[0].seriesName}：${params[0].value} m³/h`
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        // rotate: 45, // 旋转标签45度
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '流量(m³/h)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '流量',
        type: 'line',
        data: valve_pool_2_flow.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(50, 205, 50, 1)' // #32CD32
        },
        itemStyle: {
          color: 'rgba(50, 205, 50, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(50, 205, 50, 1)'
              },
              {
                offset: 1,
                color: 'rgba(50, 205, 50, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}
export const getFlowTimeChartOptionFachi3 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        return `时间：${params[0].axisValue} 分钟<br/>${params[0].seriesName}：${params[0].value} m³/h`
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '流量(m³/h)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '流量',
        type: 'line',
        data: valve_pool_3_flow.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(50, 205, 50, 1)' // #32CD32
        },
        itemStyle: {
          color: 'rgba(50, 205, 50, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(50, 205, 50, 1)'
              },
              {
                offset: 1,
                color: 'rgba(50, 205, 50, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}
export const getFlowTimeChartOptionFachi4 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        return `时间：${params[0].axisValue} 分钟<br/>${params[0].seriesName}：${params[0].value} m³/h`
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '流量(m³/h)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '流量',
        type: 'line',
        data: valve_pool_4_flow.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(50, 205, 50, 1)' // #32CD32
        },
        itemStyle: {
          color: 'rgba(50, 205, 50, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(50, 205, 50, 1)'
              },
              {
                offset: 1,
                color: 'rgba(50, 205, 50, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}
export const getFlowTimeChartOptionFachi5 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        return `时间：${params[0].axisValue} 分钟<br/>${params[0].seriesName}：${params[0].value} m³/h`
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        // rotate: 45, // 旋转标签45度
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '流量(m³/h)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '流量',
        type: 'line',
        data: valve_pool_5_flow.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(50, 205, 50, 1)' // #32CD32
        },
        itemStyle: {
          color: 'rgba(50, 205, 50, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(50, 205, 50, 1)'
              },
              {
                offset: 1,
                color: 'rgba(50, 205, 50, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}
export const getFlowTimeChartOptionFachi6 = () => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        return `时间：${params[0].axisValue} 分钟<br/>${params[0].seriesName}：${params[0].value} m³/h`
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '流量(m³/h)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '流量',
        type: 'line',
        data: valve_pool_6_flow.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(50, 205, 50, 1)' // #32CD32
        },
        itemStyle: {
          color: 'rgba(50, 205, 50, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(50, 205, 50, 1)'
              },
              {
                offset: 1,
                color: 'rgba(50, 205, 50, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}

// 最大输量下的运行参数
export const getSafeStopTimeChartOption = (distances, pressures, flows) => {
  return {
    grid: {
      top: 100,
      right: 70,
      bottom: 60,
      left: 50
    },
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        // params 是一个数组，包含每个系列的数据
        const distance = params[0].axisValue // 共享的横轴值
        const pressure = params.find((p) => p.seriesName === '压力')
        const flow = params.find((p) => p.seriesName === '流量')
        let tooltipHtml = `里程：${distance} h<br/>`
        if (pressure) {
          tooltipHtml += `${pressure.seriesName}：${pressure.value} MPa<br/>` // 压力单位改为 MPa
        }
        if (flow) {
          tooltipHtml += `${flow.seriesName}：${flow.value} m³/s`
        }
        return tooltipHtml
      }
    },
    legend: {
      data: ['压力', '流量'], // 图例显示"压力"和"流量"
      top: 10,
      textStyle: {
        fontSize: 16
      }
    },
    xAxis: {
      type: 'category',
      name: '里程（km）',
      nameLocation: 'middle',
      nameGap: 30,
      data: distances, // 横轴数据（里程）
      axisLabel: {},
      axisLine: {
        lineStyle: {}
      },
      nameTextStyle: {}
    },
    yAxis: [
      {
        name: '压力（MPa）', // 左侧 Y 轴显示"压力"
        type: 'value',
        axisLabel: {},
        axisLine: {
          lineStyle: {}
        },
        nameTextStyle: {},
        splitLine: {
          lineStyle: {}
        }
      },
      {
        name: '流量（m³/s）', // 右侧 Y 轴显示"流量"
        type: 'value',
        position: 'right', // 将流量的 y 轴放在右侧
        axisLabel: {},
        axisLine: {
          lineStyle: {}
        },
        nameTextStyle: {},
        splitLine: {
          show: false // 避免与左侧 y 轴的分割线重叠
        }
      }
    ],
    series: [
      {
        name: '压力',
        type: 'line',
        data: pressures, // 压力数据
        smooth: true,
        yAxisIndex: 0, // 绑定到第一个 y 轴
        lineStyle: {
          color: 'rgba(46, 184, 92, 1)' // 使用绿色表示压力
        },
        itemStyle: {
          color: 'rgba(46, 184, 92, 1)'
        },
        symbol: 'none',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(46, 184, 92, 1)'
              },
              {
                offset: 1,
                color: 'rgba(46, 184, 92, 0.4)'
              }
            ]
          }
        }
      },
      {
        name: '流量',
        type: 'line',
        data: flows, // 流量数据
        smooth: true,
        yAxisIndex: 1, // 绑定到第二个 y 轴
        lineStyle: {
          color: 'rgba(30, 144, 255, 1)' // 使用蓝色表示流量
        },
        itemStyle: {
          color: 'rgba(30, 144, 255, 1)'
        },
        symbol: 'none',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(30, 144, 255, 0.5)'
              },
              {
                offset: 1,
                color: 'rgba(30, 144, 255, 0.4)'
              }
            ]
          }
        }
      }
    ]
  }
}

// 最小输量下的运行参数
export const getSafeStopTimeChartOption2 = (distances, temperatures, flows) => {
  return {
    grid: {
      top: 100,
      right: 70,
      bottom: 60,
      left: 50
    },
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        // params 是一个数组，包含每个系列的数据
        const distance = params[0].axisValue // 共享的横轴值
        const temperature = params.find((p) => p.seriesName === '温度')
        const flow = params.find((p) => p.seriesName === '流量')
        let tooltipHtml = `里程：${distance} h<br/>`
        if (temperature) {
          tooltipHtml += `${pressure.seriesName}：${temperature.value} ℃<br/>`
        }
        if (flow) {
          tooltipHtml += `${flow.seriesName}：${flow.value} m³/s`
        }
        return tooltipHtml
      }
    },
    legend: {
      data: ['温度', '流量'], // 图例显示"压力"和"流量"
      top: 10,
      textStyle: {
        fontSize: 16
      }
    },
    xAxis: {
      type: 'category',
      name: '里程（km）',
      nameLocation: 'middle',
      nameGap: 30,
      data: distances, // 横轴数据（里程）
      axisLabel: {},
      axisLine: {
        lineStyle: {}
      },
      nameTextStyle: {}
    },
    yAxis: [
      {
        name: '温度（℃）', // 左侧 Y 轴显示"压力"
        type: 'value',
        axisLabel: {},
        axisLine: {
          lineStyle: {}
        },
        nameTextStyle: {},
        splitLine: {
          lineStyle: {}
        }
      },
      {
        name: '流量（m³/s）', // 右侧 Y 轴显示"流量"
        type: 'value',
        position: 'right', // 将流量的 y 轴放在右侧
        axisLabel: {},
        axisLine: {
          lineStyle: {}
        },
        nameTextStyle: {},
        splitLine: {
          show: false // 避免与左侧 y 轴的分割线重叠
        }
      }
    ],
    series: [
      {
        name: '温度',
        type: 'line',
        data: temperatures, // 压力数据
        smooth: true,
        yAxisIndex: 0, // 绑定到第一个 y 轴
        lineStyle: {
          color: 'rgba(255, 69, 0, 1)' // 使用绿色表示压力
        },
        itemStyle: {
          color: 'rgba(255, 69, 0, 1)'
        },
        symbol: 'none',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 69, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 69, 0, 0.4)'
              }
            ]
          }
        }
      },
      {
        name: '流量',
        type: 'line',
        data: flows, // 流量数据
        smooth: true,
        yAxisIndex: 1, // 绑定到第二个 y 轴
        lineStyle: {
          color: 'rgba(30, 144, 255, 1)' // 使用蓝色表示流量
        },
        itemStyle: {
          color: 'rgba(30, 144, 255, 1)'
        },
        symbol: 'none',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(30, 144, 255, 0.5)'
              },
              {
                offset: 1,
                color: 'rgba(30, 144, 255, 0.4)'
              }
            ]
          }
        }
      }
    ]
  }
}

// 最小启输压力配置
export const getMinStartPressureChartOption = (times, temperatures) => {
  return {
    grid: {
      top: 100,
      right: 70,
      bottom: 60,
      left: 50
    },
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        // params 是一个数组，包含每个系列的数据
        const time = params[0].axisValue // 共享的横轴值
        const temperature = params.find((p) => p.seriesName === '进站温度')
        let tooltipHtml = `时间：${time} h<br/>`
        if (temperature) {
          tooltipHtml += `${temperature.seriesName}：${temperature.value} ℃<br/>` //
        }
        return tooltipHtml
      }
    },
    legend: {
      data: ['进站温度'], // 图例显示"压力"和"流量"
      top: 10,
      textStyle: {
        fontSize: 16
      }
    },
    xAxis: {
      type: 'category',
      name: '小时（h）',
      nameLocation: 'middle',
      nameGap: 30,
      data: times, // 横轴数据（里程）
      axisLabel: {},
      axisLine: {
        lineStyle: {}
      },
      nameTextStyle: {}
    },
    yAxis: [
      {
        name: '进站温度（℃）', // 左侧 Y 轴显示"压力"
        type: 'value',
        axisLabel: {},
        axisLine: {
          lineStyle: {}
        },
        nameTextStyle: {},
        splitLine: {
          lineStyle: {}
        }
      }
    ],
    series: [
      {
        name: '进站温度',
        type: 'line',
        data: temperatures, // 压力数据
        smooth: true,
        yAxisIndex: 0, // 绑定到第一个 y 轴
        lineStyle: {
          color: 'rgba(229, 57, 53, 1)' // 使用绿色表示压力
        },
        itemStyle: {
          color: 'rgba(229, 57, 53, 1)'
        },
        symbol: 'none',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(229, 57, 53, 1)'
              },
              {
                offset: 1,
                color: 'rgba(229, 57, 53, 0.4)'
              }
            ]
          }
        }
      }
    ]
  }
}

// ---------------------------TODO: 根据里程来显示不同的温度、压力、流量曲线
// 温度时间变化图表配置
export const getTemperatureChartOptionByDistance = (distance) => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间：${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} °C<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站温度', '进站温度'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '温度(°C)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '温度',
        type: 'line',
        data: temperatureData.value,
        smooth: true,
        lineStyle: {
          color: '#38bdf8' // #4169E1
        },
        itemStyle: {
          color: '#38bdf8'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#38bdf8'
              },
              {
                offset: 1,
                color: 'rgba(65, 105, 225, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}

// 流量时间变化图表配置
export const getFlowChartOptionByDistance = (distance) => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        return `时间：${params[0].axisValue} 分钟<br/>${params[0].seriesName}：${params[0].value} m³/h`
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '流量(m³/h)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '流量',
        type: 'line',
        data: flowData.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(50, 205, 50, 1)' // #32CD32
        },
        itemStyle: {
          color: 'rgba(50, 205, 50, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(50, 205, 50, 1)'
              },
              {
                offset: 1,
                color: 'rgba(50, 205, 50, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}

// 阀池对应的时间变化图表配置
export const getPressureChartOptionByDistance = (distance) => {
  return {
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        let result = `时间 ${params[0].axisValue} 分钟<br/>`
        params.forEach((param) => {
          result += `${param.seriesName}：${param.value} MPa<br/>`
        })
        return result
      }
    },
    legend: {
      // data: ['出站压力', '进站压力'],
      textStyle: {
        // color: '#fff'
      }
    },
    xAxis: {
      type: 'category',
      data: timePoints.value,
      name: '时间（分钟）',
      nameLocation: 'middle',
      nameGap: 45, // 增加了轴名称与轴线的距离
      axisLabel: {
        interval: 'auto', // 自动计算显示间隔
        ...axisLabelStyle,
        margin: 14 // 增加标签与轴线的距离
      },
      nameTextStyle: axisNameStyle
    },
    yAxis: {
      type: 'value',
      name: '压力(MPa)',
      min: 0,
      axisLine: {
        show: true,
        lineStyle: {
          // color: '#000'
        }
      },
      axisLabel: axisLabelStyle,
      nameTextStyle: axisNameStyle
    },
    series: [
      {
        name: '压力',
        type: 'line',
        data: valve_pool_1_pressure.value,
        smooth: true,
        lineStyle: {
          color: 'rgba(255, 69, 0, 1)' // #FF4500
        },
        itemStyle: {
          color: 'rgba(255, 69, 0, 1)'
        },
        symbol: 'circle',
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'rgba(255, 69, 0, 1)'
              },
              {
                offset: 1,
                color: 'rgba(255, 69, 0, 0.1)'
              }
            ]
          }
        }
      }
    ]
  }
}
